package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchWaterworksProduce;
import com.ruoyi.system.service.IDispatchWaterworksProduceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 水厂生产报Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchWaterworksProduce")
public class DispatchWaterworksProduceController extends BaseController
{
    @Autowired
    private IDispatchWaterworksProduceService dispatchWaterworksProduceService;

    /**
     * 查询水厂生产报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchWaterworksProduce dispatchWaterworksProduce)
    {
        startPage();
        List<DispatchWaterworksProduce> list = dispatchWaterworksProduceService.selectDispatchWaterworksProduceList(dispatchWaterworksProduce);
        return getDataTable(list);
    }

    /**
     * 导出水厂生产报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:export')")
    @Log(title = "水厂生产报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchWaterworksProduce dispatchWaterworksProduce)
    {
        List<DispatchWaterworksProduce> list = dispatchWaterworksProduceService.selectDispatchWaterworksProduceList(dispatchWaterworksProduce);
        ExcelUtil<DispatchWaterworksProduce> util = new ExcelUtil<DispatchWaterworksProduce>(DispatchWaterworksProduce.class);
        util.exportExcel(response, list, "水厂生产报数据");
    }

    /**
     * 获取水厂生产报详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:query')")
    @GetMapping(value = "/{waterworksProduceId}")
    public AjaxResult getInfo(@PathVariable("waterworksProduceId") Long waterworksProduceId)
    {
        return success(dispatchWaterworksProduceService.selectDispatchWaterworksProduceByWaterworksProduceId(waterworksProduceId));
    }

    /**
     * 新增水厂生产报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:add')")
    @Log(title = "水厂生产报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchWaterworksProduce dispatchWaterworksProduce)
    {
        return toAjax(dispatchWaterworksProduceService.insertDispatchWaterworksProduce(dispatchWaterworksProduce));
    }

    /**
     * 修改水厂生产报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:edit')")
    @Log(title = "水厂生产报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchWaterworksProduce dispatchWaterworksProduce)
    {
        return toAjax(dispatchWaterworksProduceService.updateDispatchWaterworksProduce(dispatchWaterworksProduce));
    }

    /**
     * 删除水厂生产报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchWaterworksProduce:remove')")
    @Log(title = "水厂生产报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{waterworksProduceIds}")
    public AjaxResult remove(@PathVariable Long[] waterworksProduceIds)
    {
        return toAjax(dispatchWaterworksProduceService.deleteDispatchWaterworksProduceByWaterworksProduceIds(waterworksProduceIds));
    }
}
